package com.utonw.carloan.fragment.applyloan;

import android.content.Intent;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.RadioButton;
import android.widget.TextView;

import com.sensetime.library.finance.ocr.card.IdCardInfo;
import com.utonw.carloan.R;
import com.utonw.carloan.fragment.BaseFragment;
import com.utonw.carloan.function.GlobalLoanFunction;
import com.utonw.carloan.utils.ChooseBarUtils;

import java.util.ArrayList;

/**
 * Created by SEELE on 2017/3/22.
 */

/**
 * 申请贷款流程5：工作信息
 */
public class LoanStepFiveFragment extends BaseFragment {
    //初始化全局方法
    private GlobalLoanFunction mGlobalLoanFunction;

    @Override
    public int setLayout() {
        return R.layout.fragment_applyloan_step_five;
    }

    @Override
    public void initView(View view) {

    }

    @Override
    public void initData() {
        //初始化PickerView选择器
        mGlobalLoanFunction = new GlobalLoanFunction();
        //初始化PickerView选择器
        final GlobalLoanFunction globalLoanFunction = new GlobalLoanFunction();
        //设置ChooseBar标题
        ChooseBarUtils titleUtils = new ChooseBarUtils(getHoldingActivity()) {
            @Override
            protected void setChooseBarClickListener(int view) {

            }

            @Override
            protected void setChooseBarClickListener(int view, TextView toShow) {

                switch (view) {
                    case R.id.danweixingzhi:
                        final ArrayList<String> data1 = new ArrayList<>();
                        data1.add("机关事业单位");
                        data1.add("国有企业");
                        data1.add("三资企业");
                        data1.add("股份制企业");
                        data1.add("私营");
                        data1.add("自由职业者");
                        data1.add("社会团体");
                        data1.add("其他");

                        globalLoanFunction.setTempData(data1, toShow).oriPickerView(getContext());
                        break;

                    case R.id.zhiwei:
                        final ArrayList<String> data2 = new ArrayList<>();
                        data2.add("董事长");
                        data2.add("董事");
                        data2.add("总经理");
                        data2.add("单位高管");
                        data2.add("部门主管");
                        data2.add("普通职员");
                        data2.add("其他");

                        globalLoanFunction.setTempData(data2, toShow).oriPickerView(getContext());
                        break;


                }
            }

            @Override
            protected void getCheckedViewListener(int includeId, int sTitle, View toCheck) {
                setCheckViews(sTitle, toCheck);
            }

            @Override
            public void onToggleButtonListener(int buttonView, boolean isChecked) {

            }

            @Override
            public void getEditTextWithTipsListener(int includeId, EditText tempEt1) {

            }

            @Override
            public void onRadioButtonListener(RadioButton rMale, RadioButton rFemale) {

            }

            @Override
            public void onImageChooseBarListener(int view, ImageView mIndicator, TextView mInstruction, int sTitle) {
                switch (view) {
                    case R.id.yingyezhizhao:
                        uploadImageData(mGlobalLoanFunction,mIndicator, mInstruction, sTitle);
                        break;
                }
            }

            @Override
            public void getChangeWordsEditTextListener(int includeId, EditText tempEt1, int sTitle) {

            }

            @Override
            public void setVerificationListener() {

            }
        };
        titleUtils.initChooseBar("0","0", "enterpriseName", R.id.danweimingcheng, R.string.apply_page_five_company_name, ChooseBarUtils.ResultState.CHANGE_WORDS, "请填写单位名称");
        titleUtils.initChooseBar("0","0", "enterpriseAddress", R.id.danweidizhi, R.string.apply_page_five_company_location, ChooseBarUtils.ResultState.CHANGE_WORDS, "请填写单位地址");
        titleUtils.initChooseBar("0","0", "enterpriseType", R.id.danweixingzhi, R.string.apply_page_five_company_nature);
        titleUtils.initChooseBar("0","0", "deptName", R.id.bumen, R.string.apply_page_five_department, ChooseBarUtils.ResultState.CHANGE_WORDS, "选填");
        titleUtils.initChooseBar("0","0", "position", R.id.zhiwei, R.string.apply_page_five_job);
        titleUtils.initChooseBar("0","0", "income", R.id.nianshouru, R.string.apply_page_five_year_income, ChooseBarUtils.ResultState.EDIT_TEXT_WITH_TIPS, "元");
        titleUtils.initChooseBar("0","0", "hasSocialSecurityCards", R.id.youwushebao, R.string.apply_page_five_social_security, ChooseBarUtils.ResultState.TOGGLE_BUTTON, null);
        titleUtils.initChooseBar("0","0", "yingyezhizhao", R.id.yingyezhizhao, R.string.apply_page_five_business_licence, ChooseBarUtils.ResultState.ORI_WITH_IMAGE, null);

    }

    @Override
    protected void getIdcardFrontInfo(IdCardInfo idCardInfo) {

    }

    @Override
    protected void getIdcardBackInfo(IdCardInfo idCardInfo) {

    }

    @Override
    protected void getBankcardInfo(Intent cardData) {

    }

    @Override
    protected void getCreditcardInfo(Intent cardData) {

    }

}
